The host application will handle a Plug-in in the following manner (some code is Windows-specific!):
HMODULE hModule = LoadLibrary ("SomePlugin.dll"); if (hModule) { InitModuleProc initProc = (InitModuleProc)GetProcAddress (hModule, "InitDll"); if (initProc) { if (initProc () == false) { FreeLibrary (module); return false; } } GetFactoryProc proc = (GetFactoryProc)GetProcAddress (hModule, "GetPluginFactory"); IPluginFactory* factory = proc ? proc () : 0; if (factory) { for (int32 i = 0; i < factory->countClasses (); i++) { PClassInfo ci; factory->getClassInfo (i, &ci); FUnknown* obj; factory->createInstance (ci.cid, FUnknown::iid, (void**)&obj); ... obj->release (); } factory->release (); } ExitModuleProc exitProc = (ExitModuleProc)GetProcAddress (hModule, "ExitDll"); if (exitProc) exitProc (); FreeLibrary (hModule); }